package top.ooyyh.bytheway.mapper;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import top.ooyyh.bytheway.entity.User;
import top.ooyyh.bytheway.model.request.LoginRequest;
import top.ooyyh.bytheway.model.vo.MenuVo;

import java.util.List;
import java.util.Map;

@Mapper // 确保有这个注解
public interface UserMapper {

    User login(LoginRequest request);
    User getUserById(String id);

    User getUserByName(String username);

    @MapKey("name")
    List<Map<String, Object>> getMenuByRole(String role);

    List<String> getUserPower(String username);

    List<String> getAllRole();

    Boolean insertUser(User user);

    Boolean isUserNameExist(String username);

    List<MenuVo> getTopCatalogue(String username);

    List<MenuVo> getCatalogueByParentId(@Param("parent_id") int parentId,@Param("username") String username);

    List<MenuVo> getUserAllMenu(String username);
}
